# -*- coding: utf-8 -*-
<%!
  from cibynet.model import utils as m_utils
  from cibynet.model.m_buildings import Building
%>

<%page cached="True" cache_type="memory" />

<%namespace name="m_buildings" module="cibynet.model.m_buildings"/>

<% 
  buildings = m_utils.GetAllObjects(Building)
  hstudents = h.url_for('students')
  hrooms = h.url_for('rooms')
  hmachines = h.url_for('machines')
  menu = [("Home", "/", []), 
          ("Students", hstudents, 
            [(b.label, hstudents+"?building=%i"%b.id, []) for b in buildings]
           ), 
          ("Rooms",  hrooms, 
            [(b.label, hrooms+"?building=%i"%b.id, []) for b in buildings]
           ), 
          ("Buildings",  h.url_for('buildings'), []), 
          ("Machines", hmachines, 
            [(b.label, hmachines+"?building=%i"%b.id, []) for b in buildings]
           ), 
          ]
%>

<div id="outside">
  %if menu:
  <ul id="navigation-1">
  %for m1 in menu:
    <li><a href="${m1[1]}" title="${m1[0]}">${m1[0]}</a>
      %if m1[2]:
      <ul class="navigation-2">
        %for m2 in m1[2]:
         <li>
          <a href="${m2[1]}" title="${m2[0]}">${m2[0]}</a>
          %if m2[2]:
          <ul class="navigation-3">
          %for m3 in m2[2]:
           <li>
            <a href="${m3[1]}" title="${m3[0]}">${m3[0]}</a>
           </li>
          %endfor
          </ul>
          %endif
         </li>
        %endfor
      </ul>
      %endif
    </li>
  %endfor
  </ul>
  %endif
</div>
